{% include "../header.html" %}
<div class="layui-body">
            <h1>贼简陋的上传图片</h1>
         <h1 >复制url</h1>
        <h2 class="urls">这里是url</h2>
    <button class="layui-btn test" lay-data="{url: '/upload',accept: 'file'}">上传文件</button>
</div>


<script>
    var upload = layui.upload;
    upload.render({
  elem: '.test'
  ,done: function(res, index, upload){
    var item = this.item;
    var msg = res
            if(msg.code === 1){
                layer.msg("上传成功")
                $(".urls").text(msg.obj)
            }else if(msg.code === 0){
                layer.msg("上传失败")
            }else {
                layer.msg("上传失败")
            }
  }
})
</script>
{% include "../footer.html" %}